export function readFileAsPromise(file) {
    if (file == null || file == undefined) {
        throw new Error("file should not be null or undefined");
    }
    return new Promise((resolve, reject) => {
        const reader = new FileReader();
        reader.readAsText(file);
        reader.addEventListener('load', (event) => {
            resolve(event.target.result);
        })
        reader.addEventListener('error', (event) => {
            reject(event);
        })
    })
}

